<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/themes/bootstrap/easyui.css" />
<link type="text/css"
	href="${pageContext.request.contextPath}/themes/icon.css"
	rel="stylesheet">
<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/jquery-1.9.1.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/jquery.easyui.min.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/easyui-lang-zh_CN.js"></script>
</head>
<script type="text/javascript">
$(function(){
	$('#dg').datagrid({    
	    url:'Order',   
	    toolbar: [{
			iconCls: 'icon-remove',
			text:'删除',
			handler: function(){
				var sel = $('#dg').datagrid('getSelections');
				var ids = [];
				$.each(sel, function(i, n) {
					ids.push(n.oId);					
				})
				if (sel.length == 0) {
					$.messager.alert('提示', '请选择想要删除的对象');
				} else {
					$.ajax({
						url : 'DelOrder',
						traditional:true,
						type : 'post',
						data : {"ids" : ids},
						dataTpye : 'json',
						success : function(flag) {
							if(flag==0){
								$.messager.alert('提示', '删除失败');
							}else{
								$('#dg').datagrid('reload');
							}
						}
					})
				}			
			}
		},'-',{
			iconCls: 'icon-search',
			text:'查找',
			handler: function(){				
				var sear = $('#search').val();
				$('#dg').datagrid({
					url:'SearchOrder',
					  columns:[[    
								{field:'ck',width:100,checkbox:true}, 
						        {field:'oId',title:'订单号',width:100},    
						        {field:'oClassId',title:'订单类别ID',width:100,hidden:true}, 
						        {field:'oClass',title:'订单类别',width:100},    
						        {field:'oMeney',title:'订单金额',width:100},  
						        {field:'oTime',title:'订单时间',width:200},
						        {field:'vId',title:'VIP号',width:100},    
						        {field:'eId',title:'经手人ID',width:100,hidden:true},  
						        {field:'eName',title:'经手人',width:100,},		       	        
						    ]],						
						queryParams:{"search":sear},					
				})
				$('#dg').datagrid('reload');
			}
		},{			
			text:'<input type="text" style="width:150px" id="search" name="search">',
			disabled:true
		}],
	    columns:[[    
			{field:'ck',width:100,checkbox:true}, 
	        {field:'oId',title:'订单号',width:100},    
	        {field:'oClassId',title:'订单类别ID',width:100,hidden:true}, 
	        {field:'oClass',title:'订单类别',width:100},    
	        {field:'oMeney',title:'订单金额',width:100},  
	        {field:'oTime',title:'订单时间',width:200},
	        {field:'vId',title:'VIP号',width:100},    
	        {field:'eId',title:'经手人ID',width:100,hidden:true},  
	        {field:'eName',title:'经手人',width:100,},		       	        
	    ]],	
	    pagination:true,
	    pageList:[5,10,20,30,50,100,200],
	  	onClickCell:function(index, field, value){	  
  			if(field == 'oId'){
  				if ($('#tab').tabs('exists', '订单'+value)) {  					
					$('#tab').tabs('select', '订单'+value);
				} else {					
  					$('#tab').tabs('add', {  						
						title :'订单'+value,
						content :"<iframe  frameborder='no' width='100%' height='100%' src= /superMarketManagementSystem/function/ordermanagement/tradeinformation/orderInfo.jsp></iframe>",						
						closable : true,					
					});
  					$.ajax({
  						url:'getordertab',
  						data:{'oId':value},
  						type:'post'
  					})
				}
  			}
  		}
	});  
})
</script>
<body>

	<table id="dg"></table>
	<p style="font-size: 12px">提示：1.单击订单号显示订单详情  2.查询对话框不输入内容查询为显示所有信息</p>
	
	
	<div id="tab" class="easyui-tabs" data-options="fit:true"></div>
</body>
</html>